function insertAction(html) {

	var anySelection = false;
	var inst = tinyMCEPopup.editor;
	var focusElm = inst.selection.getNode();
	var selectedText = inst.selection.getContent({format:'text'});

	tinyMCEPopup.execCommand("mceBeginUndoLevel");
	
	if (inst.selection.getNode())
		anySelection = (inst.selection.getNode().nodeName.toLowerCase() == "img") || (selectedText && selectedText.length > 0);

	if (anySelection || (focusElm != null && focusElm.nodeName == "A")) {
		tinyMCEPopup.execCommand("mceInsertContent", false, html + inst.selection.getContent() + '</a>');
	} else {
		//alert('Nera');
	}
				
	tinyMCEPopup.execCommand("mceEndUndoLevel");
}